package com.hns.can.base.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.hns.can.base.component.BaseQuartzJob;
import com.hns.frame.service.CommonService;
import com.hns.frame.util.SpringContextUtil;
import com.hns.tool.pub.PubUtil;

/**
 * 定时任务执行
 * @author:zhangy
 * @email:zhangyu2222z@sina.cn
 * @version Revision 2.0.0
 */
@Component
public class SysTimeService extends CommonService {
	
	protected static final Logger log = LoggerFactory.getLogger(SysTimeService.class);
    
	/**
	 * 更新油价
	 * @throws Exception
	 * @author:zhangy
	 * @email:zhangyu2222z@sina.cn
	 */
	public void runEnergyPrice() throws Exception{
		log.error("~~~~~~~~~~~~~~~~energyPriceQuartzJob");
		BaseQuartzJob bean = (BaseQuartzJob)SpringContextUtil.getBean("energyPriceQuartzJob");
		if(PubUtil.isNotEmpty(bean)){
			bean.runQuartzJob();
		}
	}
	
	/**
	 * 推送报警
	 * @throws Exception
	 * @author:zhangy
	 * @email:zhangyu2222z@sina.cn
	 */
	public void runPushAlarm() throws Exception{
		log.error("~~~~~~~~~~~~~~~~runPushAlarm");
		BaseQuartzJob bean = (BaseQuartzJob)SpringContextUtil.getBean("pushAlarmQuartzJob");
		if(PubUtil.isNotEmpty(bean)){
			bean.runQuartzJob();
		}
	}

	
	public void runUpdateDataReport() throws Exception{
		log.error("~~~~~~~~~~~~~~~~updateDataReportQuartzJob");
		BaseQuartzJob bean = (BaseQuartzJob)SpringContextUtil.getBean("updateDataReportQuartzJob");
		if(PubUtil.isNotEmpty(bean)){
			bean.runQuartzJob();
		}
	}
	
}
